package com.jing21.learn.elasticsearch.intf.query;

import com.jing21.learn.elasticsearch.intf.annotaion.ESField;
import com.jing21.learn.elasticsearch.intf.enums.EsIndexTypeEnum;
import com.jing21.learn.elasticsearch.intf.enums.FieldValuePolicy;
import com.jing21.learn.elasticsearch.intf.enums.FilterType;
import com.jing21.learn.elasticsearch.intf.model.Article;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 文章查询
 */
@Data
@ApiModel("文章查询类")
public class ArticleQuery extends BaseIndexQuery<Article> {

    @ApiModelProperty(value = "状态", example = "1")
    @ESField(query = FilterType.TERM)
    private Integer state;

    @ApiModelProperty(value = "类型", example = "choice")
    @ESField(query = FilterType.TERM)
    private String type;

    @ApiModelProperty(value = "最后一次查询的Id", example = "0")
    @ESField(value = "id", query = FilterType.RANGE, valuePolicy = FieldValuePolicy.RANGE_LTE)
    private Long lastid;

    @ApiModelProperty(value = "标题", example = "吃鸡")
    @ESField(query = FilterType.MATCH_PHRASE, group = "should")
    private String title;

    @ApiModelProperty(value = "内容", example = "吃鸡")
    @ESField(query = FilterType.MATCH, group = "must")
    private String content;

    @Override
    public EsIndexTypeEnum getEsIndexType() {
        return EsIndexTypeEnum.FRIEND_CRICLE;
    }

}
